package com.engine.salary.mapper.salaryacct;

import com.engine.salary.entity.salaryacct.dto.SalaryAcctEmployeeCountDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 * 薪资核算人员
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public interface SalaryAcctEmployeeMapper {

    /**
     * 批量插入
     *
     * @param salaryAccountingEmployees
     */
    void batchInsert(@Param("collection") Collection<SalaryAcctEmployeePO> salaryAccountingEmployees);

    /**
     * 统计薪资核算记录的人数
     *
     * @param salaryAcctRecordIds
     * @return
     */
    List<SalaryAcctEmployeeCountDTO> countGroupBySalaryAcctRecordId(@Param("salaryAcctRecordIds") Collection<Long> salaryAcctRecordIds);

    /**
     * 查询合并计税的人员（分页）
     *
     * @param otherSalaryAcctRecordIds 相同税款所属期内的其他工资薪金类型的薪资账套的薪资核算记录id
     * @param param                    人员查询参数
     * @return
     */
    List<SalaryAcctEmployeePO> listPage4ConsolidatedTax(@Param("otherSalaryAcctRecordIds") Collection<Long> otherSalaryAcctRecordIds,
                                                        @Param("param") SalaryAcctEmployeeQueryParam param);

    /**
     * 查询合并计税的人员
     *
     * @param otherSalaryAcctRecordIds 相同税款所属期内的其他工资薪金类型的薪资账套的薪资核算记录id
     * @param param                    人员查询参数
     * @return
     */
    List<SalaryAcctEmployeePO> list4ConsolidatedTax(@Param("otherSalaryAcctRecordIds") Collection<Long> otherSalaryAcctRecordIds,
                                                    @Param("param") SalaryAcctEmployeeQueryParam param);

    /**
     * 分页查询薪资核算人员
     *
     * @param param
     * @return
     */
    List<SalaryAcctEmployeePO> listPage(@Param("param") SalaryAcctEmployeeQueryParam param);

    /**
     * 查询薪资核算人员
     *
     * @param param
     * @return
     */
    List<SalaryAcctEmployeePO> list(@Param("param") SalaryAcctEmployeeQueryParam param);

    /**
     * 分页查询薪资核算人员环比减少的人员
     *
     * @param lastMonSalaryAcctRecordIds
     * @param param
     * @return
     */
    List<SalaryAcctEmployeePO> listPage4Reduce(@Param("lastMonSalaryAcctRecordIds") Collection<Long> lastMonSalaryAcctRecordIds,
                                               @Param("param") SalaryAcctEmployeeQueryParam param);

    /**
     * 查询薪资核算人员环比减少的人员
     *
     * @param lastMonSalaryAcctRecordIds
     * @param param
     * @return
     */
    List<SalaryAcctEmployeePO> list4Reduce(@Param("lastMonSalaryAcctRecordIds") Collection<Long> lastMonSalaryAcctRecordIds,
                                           @Param("param") SalaryAcctEmployeeQueryParam param);

    /**
     * 根据主键id删除
     *
     * @param ids
     */
    void deleteByIds(@Param("ids") Collection<Long> ids);

    /**
     * 根据薪资核算记录id删除
     *
     * @param salaryAcctRecordIds
     */
    void deleteBySalaryAcctRecordIds(@Param("salaryAcctRecordIds") Collection<Long> salaryAcctRecordIds);

    /**
     * 条件查询
     *
     * @return 返回集合，没有返回空List
     */
    List<SalaryAcctEmployeePO> listSome(SalaryAcctEmployeePO salaryAcctEmp);

    /**
     * 根据主键查询
     *
     * @param id 主键
     * @return 返回记录，没有返回null
     */
    SalaryAcctEmployeePO getById(Long id);

    void lockByAcctEmpIds(@Param("lockStatus") Integer lockStatus, @Param("acctEmpIds") Set<Long> acctEmpIds);

    void lockByRecordId(@Param("lockStatus") Integer lockStatus, @Param("recordId") Long recordId);

    void updateIgnoreNull(@Param("salaryAcctEmployeePO")SalaryAcctEmployeePO salaryAcctEmployeePO);

    void lock(SalaryAcctEmployeePO salaryAcctEmployeePO);
}
